package com.tqz.xxljob.demo.config;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author tianqingzhao
 * @since 2023/12/15 16:00
 */
@Component
public class XxlJobHandler {
    private static final Logger logger = LoggerFactory.getLogger(XxlJobHandler.class);

    @XxlJob("TestJob") // 任务管理的 JobHandler
    public ReturnT<String> testJob() {
        logger.info("TestJob任务执行了。。。");

        String msg = System.currentTimeMillis() + " " + "执行成功";

        ReturnT<String> returnT = new ReturnT<>();
        returnT.setContent("执行成功");
        returnT.setMsg(msg);
        return returnT;
    }

}
